-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache access tokens client side #3565
Conversation
a262394
to
ea54414
Compare
ea54414
to
0e660b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small remarks/questions
if err != nil { | ||
// this can be an internal server error, a 400 oauth error or a 412 precondition failed if the wallet does not contain the required credentials | ||
return nil, err | ||
} | ||
ttl := accessTokenValidity | ||
if tokenResult.ExpiresIn != nil { | ||
ttl = time.Second * time.Duration(*tokenResult.ExpiresIn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when could it not be set 🤔 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a pointer, probably because the spec says it's optional. In our implementation it's not but you never know.
storage/session.go
Outdated
} | ||
// TTL can't go below 0 because that is translated to "no expiration" by the library | ||
// in that case it should be 1 nanosecond | ||
if opts.ttl < 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or just not put it in cache?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦
Cache access tokens per request. Subsequent requests are fulfilled from cache.
Added SessionOption to allow for custom
ttl
on session store.Only implemented for
auth.iam
, not forauth/v1
closes #3552